{% extends "template-base.html" %}

{% block title %}江流天地外{% endblock %}
{% block keywords %}江流天地外，原创，视频教程，编程，Java，Android，Python {% endblock %}
{% block description %}首页{% endblock %}
{% block head_link_script %}
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    {% load staticfiles %}
    <link rel="stylesheet" type="text/css" href="{% static "UE/third-party/SyntaxHighlighter/shCoreDefault.css" %}">
    <script type="text/javascript" src="{% static "UE/third-party/SyntaxHighlighter/shCore.js" %}"></script>
    <script type="text/javascript" charset="utf-8" src="{% static "UE/ueditor.config.js" %}"></script>
    <script type="text/javascript" charset="utf-8" src="{% static "UE/ueditor.all.min.js" %}"></script>
    <script type="text/javascript" charset="utf-8" src="{% static "UE/lang/zh-cn/zh-cn.js" %}"></script>
    <script type="text/javascript">
        SyntaxHighlighter.all();
    </script>
    <style>
    a:hover {
        text-decoration: none
    }
    </style>
{% endblock %}

{% block content %}
    <script type="application/javascript">
        function login() {
            window.location.href = '/login';
        }
    </script>
    {% if objects.object_list %}
        {% for article in objects.object_list %}
            <div class="post excerpt">
                <div class="{% cycle 'post-date-ribbon' 'post-date-ribbon_green' %}">
                    <div class="{% cycle 'corner' 'corner_green' %}"></div>
                    {{ article.create_time | date:"Y年m月d日" }}
                </div>
                <header>
                    <h2 class="{% cycle 'title' 'title_green' %}">
                        <a href="/article/{{ article.id }}" rel="bookmark">{{ article.title }}</a>
                    </h2>

                    <div class="{% cycle 'post-info' 'post-info_green' %}">
                        <div class="author_mt hp_meta"><span class="mt_icon"></span>
                            <a href="http://www.dreamlu.net" target="_blank"
                               title="作者：{{ article.user.user.username }}">{{ article.user.user.username }}</a>
                        </div>
                        <div class="cat_mt hp_meta"><span class="mt_icon"></span><a
                                title="分类：{{ article.category.type }}"
                                href="/category/{{ article.category.id }}">{{ article.category.type }}</a>
                        </div>
                        <div class="time_mt hp_meta"><span
                                class="time_icon"></span>{{ article.update_time| date:"Y年m月d日" }}</div>
                        <div class="view_mt hp_meta"><span class="view_icon"
                                                           title="浏览次数"> </span>浏览{{ article.view_count }}次
                        </div>
                        <div class="comment_mt hp_meta"><span class="mt_icon" title="评论次数"> </span>评论0次</div>
                    </div>
                </header>
                <div class="post-content image-caption-format-1">
                    {#去掉html转义字符#}
                    {% autoescape off %}
                        {#truncatechars 限制显示最大字符数#}
                        {{ article.content|truncatechars:600 }}
                    {% endautoescape %}
                </div>
                <div class="{% cycle 'readMore' 'readMore_green' %}">
                    <a href="/article/{{ article.id }}" title="{{ article.title }}" rel="more">阅读全部</a>
                </div>
            </div>
        {% endfor %}

        <ul class="pagination">
            {% if objects.has_previous %}
                <li><a href="?page={{ objects.previous_page_number }}">前一页</a></li>
            {% else %}
                <li class="disabled"><a>前一页</a></li>
            {% endif %}

            {% for p in page_range %}
                {% ifequal p objects.number %}
                    <li class="active"><a>{{ p }}</a></li>
                {% else %}
                    <li><a href="?page={{ p }}" title="第{{ p }}页">{{ p }}</a>
                    <li>
                {% endifequal %}
            {% endfor %}

            {% if objects.has_next %}
                <li><a href="?page={{ objects.next_page_number }}">后一页</a></li>
            {% else %}
                <li class="disabled"><a>后一页</a></li>
            {% endif %}
        </ul>
    {% endif %}

    {% comment %}<ul class="am-pagination am-pagination-centered">
        {% if objects.has_previous %}
            <li><a href="?page={{ objects.previous_page_number }}">前一页</a></li>
        {% else %}
            <li class="am-disabled"><a>前一页</a></li>
        {% endif %}

        {% for p in page_range %}
            {% ifequal p objects.number %}
                <li class="am-active"><a>{{ p }}</a></li>
            {% else %}
                <li><a href="?page={{ p }}" title="第{{ p }}页">{{ p }}</a>
                <li>
            {% endifequal %}
        {% endfor %}

        {% if objects.has_next %}
            <li><a href="?page={{ objects.next_page_number }}">后一页</a></li>
        {% else %}
            <li class="am-disabled"><a>后一页</a></li>
        {% endif %}
    </ul>{% endcomment %}
{% endblock %}
